package cn.edu.stu.syllabus.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import cn.edu.stu.syllabus.repository.library.local.BookEntry;
import cn.edu.stu.syllabus.repository.oa.local.OaInfoEntry;
import cn.edu.stu.syllabus.repository.oaRead.local.OaReadEntry;

import cn.edu.stu.syllabus.dao.BookEntryDao;
import cn.edu.stu.syllabus.dao.OaInfoEntryDao;
import cn.edu.stu.syllabus.dao.OaReadEntryDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig bookEntryDaoConfig;
    private final DaoConfig oaInfoEntryDaoConfig;
    private final DaoConfig oaReadEntryDaoConfig;

    private final BookEntryDao bookEntryDao;
    private final OaInfoEntryDao oaInfoEntryDao;
    private final OaReadEntryDao oaReadEntryDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        bookEntryDaoConfig = daoConfigMap.get(BookEntryDao.class).clone();
        bookEntryDaoConfig.initIdentityScope(type);

        oaInfoEntryDaoConfig = daoConfigMap.get(OaInfoEntryDao.class).clone();
        oaInfoEntryDaoConfig.initIdentityScope(type);

        oaReadEntryDaoConfig = daoConfigMap.get(OaReadEntryDao.class).clone();
        oaReadEntryDaoConfig.initIdentityScope(type);

        bookEntryDao = new BookEntryDao(bookEntryDaoConfig, this);
        oaInfoEntryDao = new OaInfoEntryDao(oaInfoEntryDaoConfig, this);
        oaReadEntryDao = new OaReadEntryDao(oaReadEntryDaoConfig, this);

        registerDao(BookEntry.class, bookEntryDao);
        registerDao(OaInfoEntry.class, oaInfoEntryDao);
        registerDao(OaReadEntry.class, oaReadEntryDao);
    }
    
    public void clear() {
        bookEntryDaoConfig.clearIdentityScope();
        oaInfoEntryDaoConfig.clearIdentityScope();
        oaReadEntryDaoConfig.clearIdentityScope();
    }

    public BookEntryDao getBookEntryDao() {
        return bookEntryDao;
    }

    public OaInfoEntryDao getOaInfoEntryDao() {
        return oaInfoEntryDao;
    }

    public OaReadEntryDao getOaReadEntryDao() {
        return oaReadEntryDao;
    }

}
